Trees | Indices | Toggle frames |
---|
event.EventDispatcher --+ | EventLoop
The main run loop of the application.
Calling run begins the application event loop, which processes operating system events, calls pyglet.clock.tick to call scheduled functions and calls pyglet.window.Window.on_draw and pyglet.window.Window.flip to update window contents.
Applications can subclass EventLoop and override certain methods to integrate another framework's run loop, or to customise processing in some other way. You should not in general override run, as this method contains platform-specific code that ensures the application remains responsive to the user while keeping CPU usage to a minimum.
on_enter()
The event loop is about to begin.
|
|
on_exit()
The event loop is about to exit.
|
|
on_window_close(window)
A window was closed.
|
dispatch_event(self,
event_type,
*args)
Dispatch a single event to the attached handlers.
(Inherited from pyglet.event.EventDispatcher)
|
|
event(self,
*args)
Function decorator for an event handler.
(Inherited from pyglet.event.EventDispatcher)
|
|
exit(self)
Safely exit the event loop at the end of the current iteration.
|
|
float |
idle(self)
Called during each iteration of the event loop.
|
pop_handlers(self)
Pop the top level of event handlers off the stack.
(Inherited from pyglet.event.EventDispatcher)
|
|
push_handlers(self,
*args,
**kwargs)
Push a level onto the top of the handler stack, then attach zero or
more event handlers.
(Inherited from pyglet.event.EventDispatcher)
|
|
register_event_type(cls,
name)
Register an event type with the dispatcher.
(Inherited from pyglet.event.EventDispatcher)
|
|
remove_handler(self,
name,
handler)
Remove a single event handler.
(Inherited from pyglet.event.EventDispatcher)
|
|
remove_handlers(self,
*args,
**kwargs)
Remove event handlers from the event stack.
(Inherited from pyglet.event.EventDispatcher)
|
|
run(self)
Begin processing events, scheduled functions and window updates.
|
|
set_handler(self,
name,
handler)
Attach a single event handler.
(Inherited from pyglet.event.EventDispatcher)
|
|
set_handlers(self,
*args,
**kwargs)
Attach one or more event handlers to the top level of the handler
stack.
(Inherited from pyglet.event.EventDispatcher)
|
event_types =
|
|
has_exit = False
|
The event loop is about to begin.
This is dispatched when the event loop is prepared to enter the main run loop, and represents the last chance for an application to initialise itself.
A window was closed.
This event is dispatched when a window is closed. It is not dispatched if the window's close button was pressed but the window did not close.
The default handler calls exit if no more windows are open. You can override this handler to base your application exit on some other policy.
Safely exit the event loop at the end of the current iteration.
This method is convenience for setting has_exit to True.
Called during each iteration of the event loop.
The method is called immediately after any window events (i.e., after
any user input). The method can return a duration after which
the idle method will be called again. The method may be called
earlier if the user creates more input events. The method
can return None
to only wait for user events.
For example, return 1.0 to have the idle method called every second, or immediately after any user events.
The default implementation dispatches the pyglet.window.Window.on_draw event for all windows and uses pyglet.clock.tick and pyglet.clock.get_sleep_time on the default clock to determine the return value.
This method should be overridden by advanced users only. To have code execute at regular intervals, use the pyglet.clock.schedule methods.
None
to block for user input.Begin processing events, scheduled functions and window updates.
This method returns when has_exit is set to True.
Developers are discouraged from overriding this method, as the implementation is platform-specific.
Trees | Indices | Toggle frames |
---|
Generated by Epydoc 3.0beta1 on Thu Dec 31 17:58:18 2009 | http://epydoc.sourceforge.net |